<html>
<!-- This whole file may be made obsolete by the earl wiki calendar. :) this will force staff to use the wiki -->
<head><title>News Feed Builder</title>
<link rel="stylesheet" type="text/css" href="css/Default.css" />
<Script language="javascript" src="data/password.js"></script>
<Script language="javascript" src="exec/login.js"></script>
<noscript>
location.href="noscript.html";
</noscript>
<SCRIPT LANGUAGE="JavaScript">

	window.onload = redir(password.length);

//name of cookie: 'eomdmf'

</SCRIPT>
<style type='text/css'>
</style>
</head>
<br>
<center><h1>News Feed Builder</h1><center>
<br>
<body>

<center><p style="font-family: Arial; font-size:20px">Events can be added up to 4 weeks in the future.<br> Select a date, type in the event then press the 'Submit Event' button.</p><center>
<form method="POST" action="Save_P_NewsFeed.php" name="form_detail"> 

<SELECT NAME="ShowDate">
<!-- the dates are auto added here with javascript-->
<option value="">Select a date...</option>
</SELECT>

<br>
<!--<label for="newsfeed"><span class="req"></span></label> not needed?-->
<!--Text are is below-->
<textarea name="NewsFeed" id="NewsFeed" rows="20" cols="70" style="border: 2px solid #000000;padding: 5px;color:000000;background-color: #FFFFFF;font-family: Arial"></textarea>
<br><br>
<!--submit, works via PHP on next page-->
<input id="subbut" type="submit" value="Submit Event">
</form>



<!-- hidden magic button it's for debugging.
<center><input type="button" onclick='gototheaterurl()' value="Check"></center> -->
<script language="javascript">
	populateDateList();

	//this is used as a debug, to show the value of the selected date
	function gototheaterurl() {
		var f = document.form_detail;
		var val = f.ShowDate.options[f.ShowDate.selectedIndex].value +":"+ document.getElementById('NewsFeed').value;
		alert(val);
	}

	//get the last 'amt' characters of the string 'str'
	function getLastChars(str, amt) {
		var last = str.substring(str.length - amt, str.length);
		return last;
	}
		
		//populate the date list, with Day, Month Date
	function populateDateList() {
		var days_array = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
		var months_array = new Array ('Jan','Feb','March','April','May','June','July','Aug','Sept','Oct','Nov','Dec');
		var today = new Date();
		for (var date_counter = 1; date_counter < 28; date_counter++) {
			var formattedDate = months_array[today.getMonth()] + " " + today.getDate() + suffix(today.getDate());
			document.form_detail.ShowDate.options[date_counter] = new Option(days_array[today.getDay()] + ", " + months_array[today.getMonth()] + " " + today.getDate(), formattedDate);
			if (today.getYear() > 1900) {
				today = new Date(today.getYear(),today.getMonth(),today.getDate() + 1,0,0,0,0);
			} else {
				today = new Date(today.getYear() + 1900,today.getMonth(),today.getDate() + 1,0,0,0,0);
			}
		}
	}

	//get the suffix for number date.
	function suffix(input){
		var ret = "";
		var num = input+"";
		input = num.substring(num.length - 1, num.length);
		
		if(num == "11" || num == "12" || num == "13"){
			input = 4;
		}
		
		//alert(num +" "+ input);
		
		if(input == 1){
			ret = "st";
		}else if(input == 2){
			ret = "nd";
		}else if(input == 3){
			ret = "rd";
		}else{
			ret = "th";
		}
		return ret;
	}
</script>

<FORM METHOD="LINK" ACTION="index.html">
<INPUT TYPE="submit" VALUE="Home Page">
</FORM>
		
<FORM METHOD="LINK" ACTION="LoggedIn.php">
<INPUT TYPE="submit" VALUE="Return to Main Menu">
</FORM>
</body>
</html>

